package com.jinzhi.jzweb.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.jinzhi.jzapi.common.pojo.DataStatisticeVo;
import com.jinzhi.jzapi.common.pojo.ResultDataStatisticeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jinzhi.jzweb.dao.ExaminationCostDao;
import com.jinzhi.jzweb.domain.ExaminationCostDO;
import com.jinzhi.jzweb.service.ExaminationCostService;
import com.jinzhi.common.base.CoreServiceImpl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 
 * <pre>
 * 
 * </pre>
 * <small> 2021-04-19 09:36:13 | Long</small>
 */
@Service
public class ExaminationCostServiceImpl extends CoreServiceImpl<ExaminationCostDao, ExaminationCostDO> implements ExaminationCostService {

    @Autowired
    private ExaminationCostDao examinationCostDao;

    @Override
    public Page<Map<Object, Object>> selectSchool(int pageNumber, int pageSize, String name, List<String> list1,Integer year) {
//        Map map=new HashMap();
//        map.put("pageNumber",pageNumber);
//        map.put("pageSize",pageSize);
//        map.put("name",name);
//        return examinationCostDao.listCost(map);

        Page<Map<Object,Object>> page = new Page<>(pageNumber, pageSize);
        List<Map<Object,Object>> list;
        list= this.examinationCostDao.listCost(page,name,list1,year);
        List<Map<Object,Object>> list11=new ArrayList<>();
            for(Map ll:list){
             Map map=new HashMap();
             map.put("name",ll.get("name")+"--"+ll.get("profile")+"--考试人数："+ll.get("stuNum")+"--"+ll.get("data"));
                map.put("id",ll.get("id"));
                list11.add(map);
            }

        return page.setRecords(list11);
    }


    @Override
    public Page<Map<Object, Object>> selectSchool2(int pageNumber, int pageSize, String name, List<String> list1,Integer year) {
//        Map map=new HashMap();
//        map.put("pageNumber",pageNumber);
//        map.put("pageSize",pageSize);
//        map.put("name",name);
//        return examinationCostDao.listCost(map);

        Page<Map<Object,Object>> page = new Page<>(pageNumber, pageSize);
        List<Map<Object,Object>> list;
        list= this.examinationCostDao.listCost2(page,name,list1,year);
        List<Map<Object,Object>> list11=new ArrayList<>();
        for(Map ll:list){
            Map map=new HashMap();
            map.put("name",ll.get("name")+"--"+ll.get("profile")+"--考试人数："+ll.get("stuNum")+""+"--"+ll.get("data"));
            map.put("id",ll.get("id"));
            list11.add(map);
        }

        return page.setRecords(list11);
    }

    public Page<Map<Object, Object>> selectSchool3(int pageNumber, int pageSize, String name, List<String> list1,String year) {
//        Map map=new HashMap();
//        map.put("pageNumber",pageNumber);
//        map.put("pageSize",pageSize);
//        map.put("name",name);
//        return examinationCostDao.listCost(map);

        Page<Map<Object,Object>> page = new Page<>(pageNumber, pageSize);
        List<Map<Object,Object>> list;
        list= this.examinationCostDao.listCost3(page,name,list1,year);
        List<Map<Object,Object>> list11=new ArrayList<>();
        for(Map ll:list){
            Map map=new HashMap();
            map.put("name","年份："+ll.get("year")+"--学校："+ll.get("name")+"--"+ll.get("profile")+"--考试人数："+ll.get("stuNum")+"--"+ll.get("data"));
            map.put("id",ll.get("id"));
            list11.add(map);
        }

        return page.setRecords(list11);
    }

    @Override
    public List<ResultDataStatisticeVo> examinationCostTotal(DataStatisticeVo dataStatisticeVo) {
        List<ResultDataStatisticeVo> resultDataStatisticeVo = examinationCostDao.examinationCostTotal(dataStatisticeVo);
        return resultDataStatisticeVo;
    }
}
